import request from "@/utils/request.js";
import Cache from "@/utils/cache.js"
const url = '/salesman'
/**
 * 商品列表查询
 */
export function getGoodsListApi(data) {
	return request.get(url + '/mall/goods/getGoodsList', data);
}

/**
 *  收藏商品
 */
export function collectGoods(goodsId) {
	return request.post(url + `/mall/goodsCollection/${goodsId}`);
}

/**
 *  取消收藏
 */
export function deleteCollect(goodsId) {
	return request.delete(url + `/mall/goodsCollection/${goodsId}`);
}

/**
 * 收藏列表
 */
export function collectList(data) {
	return request.get(url + `/mall/goodsCollection/upList`, data);
}

/**
 * 收藏失效
 */
export function getInvalidListApi(data) {
	return request.get(url + `/mall/goodsCollection/downList`, data);
}

/**
 *  清空收藏
 */
export function clearList(goodsId) {
	return request.delete(url + `/mall/goodsCollection/clear`);
}

/**
 * 根据商品ID获取商品详情
 * @param id:string
 */
export const getGoodsDetail = async (id, tenantId) => {
	return request.get(url + `/mall/goods/${id}/${tenantId}`)
}

/**
 *  领取码
 */
export function getNoReceiveListBySalesman(data) {
	return request.post(url + `/order/getNoReceiveListBySalesmanFromOrder`, data);
}
//     业务员 上架商品
// 根据业务员ID获取该业务员勾选的商品ID集合
export const getGoodsIdListBySalesmanId = async (tenantId) => {
	return request.get(url + `/salesman_good_check/getGoodsIdListBySalesmanId/${tenantId}`)
}
// 更新业务员的勾选的商品ID集合
export function updateGoodsIdList(data) {
	return request.post(url + `/salesman_good_check/updateGoodsIdList`, data);
}
// 下架业务员的勾选的商品ID集合
export function delistGoodsIdList(data) {
	return request.post(url + `/salesman_good_check/delistGoodsIdList`, data);
}

//查询业务员推广金额
export function queryPromotionAmount(data) {
	return request.get(url + `/order/queryPromotionAmount`, data);
}
